package com.dhwl.hsh.merchant.model.impl;

import com.dhwl.hsh.lib.api.ApiManager;
import com.dhwl.hsh.lib.bean.HttpResponse;
import com.dhwl.hsh.lib.bean.resp.DataPage;
import com.dhwl.hsh.lib.bean.resp.OrderDetailResp;
import com.dhwl.hsh.lib.bean.resp.OrderListResponse;
import com.dhwl.hsh.lib.constant.ServerConstant;
import com.dhwl.hsh.merchant.model.IOrderModel;

import rx.Observable;

/**
 * 简要描述
 *
 * @author Derek.Kidd
 * @version V1.0.0
 * @date 2016-04-13 15:42
 */
public class OrderModel implements IOrderModel {


    private OrderModel() {
    }

    public static final OrderModel instance = new OrderModel();

    public static OrderModel getInstance() {
        return instance;
    }

    @Override
    public Observable<HttpResponse<DataPage<OrderListResponse>>> getOrders(int pageNo, int orderState) {
        return ApiManager.getInstance().getOrderApi().getOrders(pageNo, ServerConstant.LIST_PAGE_SIZE, orderState);
    }

    @Override
    public Observable<HttpResponse<OrderDetailResp>> getOrderDetail(String orderId) {
        return ApiManager.getInstance().getOrderApi().getOrderDetail(orderId);
    }

    @Override
    public Observable<HttpResponse<String>> cancelOrder(int type, String orderId) {
        return ApiManager.getInstance().getOrderApi().cancelOrder(type, orderId);
    }
}
